﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AllenData
{
    public class InteractionTopicData
    {
        public void AddNewInteractionTopicData(InteractionTopic interactionTopic)
        {
            using (var ctx = new AllenNeighborhoodEntities())
            {
                ctx.AddToInteractionTopics(interactionTopic);
                ctx.SaveChanges();
            }
        }

        public InteractionTopic GetInteractionTopic(int interactionID, int topicID)
        {
            using (var ctx = new AllenNeighborhoodEntities())
            {
                return (ctx.InteractionTopics.Where(c => c.InteractionID == interactionID && c.TopicID == topicID)).FirstOrDefault();
            }
        }

        public List<InteractionTopic> GetInteractionTopics(int interactionID)
        {
            using (var ctx = new AllenNeighborhoodEntities())
            {
                return ctx.InteractionTopics.Where(c => c.InteractionID == interactionID).ToList();
            }
        }
    }
}